const arr = [
  { subject: 'Math', score: 90 },
  { subject: 'Chinese', score: 90 },
  { subject: 'English', score: 100 },
  { subject: 'Math', score: 80 },
  { subject: 'Chinese', score: 95 }
]

function getCategory (arr) {
  return arr.reduce((acc, cur) => {
    if (!acc[cur.subject]) {
      acc[cur.subject] = []
    }
    acc[cur.subject].push(cur)
    return acc
  }, {})
}

console.log(getCategory(arr))
